package com.iot.manage.service;

import com.alibaba.fastjson.JSONObject;
import com.iot.manage.dao.CompanyMapper;
import com.iot.manage.pojo.Company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyService {

    @Autowired
    private CompanyMapper companyMapper;

    public List<Company> findCompanyList(String query, int pagenum, int pagesize) {
        return companyMapper.findCompanyList(query,pagesize * (pagenum - 1),pagesize * pagenum);
    }

    public int countCompanyList(String query) {
        return companyMapper.countCompanyList(query);
    }

    public void addCompanyInfo(JSONObject params) {
        companyMapper.addCompanyInfo(params);
    }

    public Company findCompanyInfoByIdOrCode(String params) {
        return companyMapper.findCompanyInfoByIdOrCode(params);
    }

    public void updateCompanyInfo(JSONObject params) {
        companyMapper.updateCompanyInfo(params);
    }

    public void removeCompanyInfo(String companyId) {
        companyMapper.removeCompanyInfo(companyId);
    }

}
